<?php

@error_reporting(E_ALL ^ E_NOTICE);

if ( PHP_VERSION < "4.1.0" )
{
    $_GET =& $HTTP_GET_VARS;
    $_POST =& $HTTP_POST_VARS;
    $_COOKIE =& $HTTP_COOKIE_VARS;
    $_SERVER =& $HTTP_SERVER_VARS;
    $_ENV =& $HTTP_ENV_VARS;
    $_FILES =& $HTTP_POST_FILES;
}

if(!function_exists('iconv'))
{
	if (function_exists('mb_convert_encoding'))
	{
		function iconv($f,$t,$s) { return mb_convert_encoding ($s,$t,$f);}
	}
	else
	{
		function iconv() { die("<div style='color:red;font-size:20px;'>no convert encoding function found!</div>"); }
	}
}

if (!function_exists('json_encode'))
{
	function json_encode($arr)
	{
		$keys = array_keys($arr);
		$isarr = true;
		$json = "";
		for ( $i=0; $i<count($keys); $i++)
		{
			if ($keys[$i] !== $i)
			{
				$isarr = false;
				break;
			}
		}
		$json = $space;
		$json.= ($isarr)?"[":"{";
		for( $i=0; $i<count($keys); $i++)
		{
			if ($i!=0) $json.= ",";
			$item = $arr[$keys[$i]];
			$json.= ($isarr)?"":'"'.$keys[$i].'":';
			if (is_array($item))
				$json.= json_encode($item);
			else if (is_string($item))
				$json.= '"'.str_replace(array("\r","\n"),array('\r','\n'),addslashes($item)).'"';
			else if ($item)
				$json.= $item;
			else
				$json.= "null";
		}
		$json.= ($isarr)?"]":"}";
		return $json;
	}
}


if (ini_get('register_globals'))
{
	if (isset($_REQUEST['GLOBALS'])) die('what do you want to do?');
	$_notunset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES');

	$_input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
	foreach($_input as $_k => $_v)
	{
		if (!in_array($_k, $_notunset) && isset($GLOBALS[$_k])) 
		{
			$GLOBALS[$_k] = NULL;
			unset($GLOBALS[$_k]);
		}
	}
	unset($_input);
	unset($_notunset);
}
if ($_GET['PHPSID']) @session_id($_GET['PHPSID']);
session_start();

if (!get_magic_quotes_gpc()) 
{
	$_evalstr = <<<END
		if (is_array(#_xxxxx))
		{
			while (list(#k, #v) = each(#_xxxxx))
			{
				if (is_array(#_xxxxx[#k]))
				{
					while (list(#k2, #v2) = each(#_xxxxx[#k])) #_xxxxx[#k][#k2] = addslashes(#v2);
					@reset(#_xxxxx[#k]);
				}
				else #_xxxxx[#k] = addslashes(#v);
			}
			@reset(#_xxxxx);
		}
END;
	@eval(str_replace(array("xxxxxx",'#'),array('GET','$'),$_evalstr));
	@eval(str_replace(array("xxxxxx",'#'),array('POST','$'),$_evalstr));
	@eval(str_replace(array("xxxxxx",'#'),array('COOKIE','$'),$_evalstr));
	unset($_evalstr);
}

include_once(LZ_BASEPATH.LZ_CONFIG_FILE);

?>